package proxy;

import java.lang.reflect.Proxy;

public class IntermediaryJdkProxyFactory {
    /**
     5. * 工厂方法
     6. * @param target 需要被代理的目标对象
     7. * @return 返回生成好的代理对象
     8. */
 public static <T> T create(Object target) {
         IntermediaryInvocationHandler handler = new
         IntermediaryInvocationHandler();
         handler.setTarget(target);
         return (T) Proxy.newProxyInstance(target.getClass().getClassLoader(),
              target.getClass().getInterfaces(), handler);
         }
}
